﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Think.Lenovo.Com.DataAccess;
using System.Data;
using Think.Lenovo.Com.Models.Material;
using Think.Lenovo.Com.DataAccess;
using Think.Lenovo.Com.Models;

namespace Think.Lenovo.Com
{
    public partial class MaterialAddToDistributor : System.Web.UI.Page
    {
        MaterialInfo minfo = new MaterialInfo();
        //MaterialBulletin mater = new MaterialBulletin();
 
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                int id = Int32.Parse(Request.QueryString["id"].ToString());
                DataSet ds = new DataSet();
                ds = minfo.GetMaterialById(id);
                if (!IsPostBack)
                {
                    //  txt_title.Text = ds.
                }
            }
            catch(Exception ex)
            {}
        }

        protected void btn_add_Click(object sender, EventArgs e)
        {
            //DataSet ds = new DataSet();
            //model.Title = txt_title.Text;
            //model.MaterialClass = "";
            //model.MaterialNum = "";
            //model.Content = editor.Value;
            //model.ReleaseTime = DateTime.Now;

            //long MaterialBulletin_Id = info.AddMaterial(model);

            //if (MaterialBulletin_Id > 0)
            //{
            //    //物料添加成功后,给选中的分区的每个分销商发送通知
            //    foreach (ListItem item in this.cbl_region.Items)
            //    {
            //        if (item.Selected == true)
            //        {
            //            for (int j = 0; j < uinfo.GetUserIdByRegionLevelCount(1, Int32.Parse(item.Value)); j++)
            //            {
            //                RM.MaterialBulletin_Id = Int32.Parse(MaterialBulletin_Id.ToString());
            //                RM.Receive = 0;
            //                RM.UserId = Int32.Parse(uinfo.GetUserIdByRegionLevel(1, Int32.Parse(item.Value)).Tables[0].Rows[0][j].ToString());
            //                RM.RegionId = Int32.Parse(item.Value);

            //                RMinfo.AddReceiveMaterial(RM);
            //            }
            //        }
            //    }
            //    Response.Write("<script>alert('添加成功');location.href=location.href;</script>");
            //}
        }

        protected void Add_Click(object sender, EventArgs e)
        {

        }
    }
}